dialog: Remove alternative button order API
authorTimm Bäder <mail@baedert.org>
Tue, 4 Oct 2016 08:03:52 +0000 (10:03 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 16 Oct 2016 16:17:21 +0000 (18:17 +0200)
14 files changed:
docs/reference/gtk/gtk4-sections.txt
gtk/deprecated/gtkcolorseldialog.c
gtk/deprecated/gtkfontsel.c
gtk/gtkappchooserdialog.c
gtk/gtkcolorchooserdialog.c
gtk/gtkdialog.c
gtk/gtkdialog.h
gtk/gtkfilechoosernative.c
gtk/gtkfilechooserwidget.c
gtk/gtkfontchooserdialog.c
gtk/gtkmessagedialog.c
gtk/gtkmountoperation.c
gtk/gtkpagesetupunixdialog.c
gtk/gtkprintunixdialog.c

index de5eb7c2519f94ab27230b099a7069a4f3042c92..c2ab2d2ad98d2f53b32de1d33356395cee376a7d 100644 (file)
@@ -1070,8 +1070,6 @@ gtk_dialog_get_content_area
 gtk_dialog_get_header_bar
 <SUBSECTION>
 gtk_alternative_dialog_button_order
-gtk_dialog_set_alternative_button_order
-gtk_dialog_set_alternative_button_order_from_array
 
 <SUBSECTION Standard>
 GTK_DIALOG
index 7ff28ec86656696853befcb695594905897cded0..b3913b3c85eb029f8837985bd387127ccb4c0d06 100644 (file)
@@ -203,12 +203,6 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
 
   gtk_widget_hide (priv->help_button);
 
-  gtk_dialog_set_alternative_button_order (dialog,
-                                          GTK_RESPONSE_OK,
-                                          GTK_RESPONSE_CANCEL,
-                                          GTK_RESPONSE_HELP,
-                                          -1);
-
   gtk_window_set_title (GTK_WINDOW (colorseldiag),
                         _("Color Selection"));
 }
index 4525e39c4535399d7814ddcd0286e94b7fc5c81f..a5b8aaf84260ebfcb3723823ef634e3b8a7a3dd3 100644 (file)
@@ -1699,12 +1699,6 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag)
                                            GTK_RESPONSE_OK);
   gtk_widget_grab_default (priv->ok_button);
 
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontseldiag),
-                                          GTK_RESPONSE_OK,
-                                          GTK_RESPONSE_APPLY,
-                                          GTK_RESPONSE_CANCEL,
-                                          -1);
-
   gtk_window_set_title (GTK_WINDOW (fontseldiag),
                         _("Font Selection"));
 
index 8837e3ecd3953e3addb0c487f565bcb207b2254b..1694547e9870db359c8011945aac3737aa1e1817 100644 (file)
@@ -713,13 +713,6 @@ gtk_app_chooser_dialog_init (GtkAppChooserDialog *self)
   gtk_widget_init_template (GTK_WIDGET (self));
   gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (self));
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (self),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
   /* we can't override the class signal handler here, as it's a RUN_LAST;
    * we want our signal handler instead to be executed before any user code.
    */
index fdedc8786c147e2a19066ec47117f85e9c094b85..a06b7d1eb5876414bce1fc0fee6146337a8e8d1a 100644 (file)
@@ -107,13 +107,6 @@ gtk_color_chooser_dialog_init (GtkColorChooserDialog *cc)
   gtk_widget_init_template (GTK_WIDGET (cc));
   gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (cc));
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (cc),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
   g_signal_connect (cc, "response",
                     G_CALLBACK (gtk_color_chooser_dialog_response), NULL);
 }
index 85e6f7555dfdec40c3d18857a0b9bf2d87ac1fde..0a6fa6c6cd0c12aad89875ce7fca3901b88ab608 100644 (file)
@@ -836,31 +836,6 @@ gtk_dialog_style_updated (GtkWidget *widget)
   update_spacings (GTK_DIALOG (widget));
 }
 
-static GtkWidget *
-dialog_find_button (GtkDialog *dialog,
-                   gint       response_id)
-{
-  GtkWidget *child = NULL;
-  GList *children, *tmp_list;
-
-  children = get_action_children (dialog);
-
-  for (tmp_list = children; tmp_list; tmp_list = tmp_list->next)
-    {
-      ResponseData *rd = get_response_data (tmp_list->data, FALSE);
-
-      if (rd && rd->response_id == response_id)
-       {
-         child = tmp_list->data;
-         break;
-       }
-    }
-
-  g_list_free (children);
-
-  return child;
-}
-
 static void
 gtk_dialog_close (GtkDialog *dialog)
 {
@@ -1066,17 +1041,6 @@ gtk_dialog_add_button (GtkDialog   *dialog,
   button = gtk_button_new_with_label (button_text);
   gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
 
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-  if (button_text)
-    {
-      GtkStockItem item;
-      if (gtk_stock_lookup (button_text, &item))
-        g_object_set (button, "use-stock", TRUE, NULL);
-    }
-
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
   gtk_style_context_add_class (gtk_widget_get_style_context (button), "text-button");
   gtk_widget_set_can_default (button, TRUE);
 
@@ -1487,185 +1451,6 @@ gtk_dialog_get_response_for_widget (GtkDialog *dialog,
     return rd->response_id;
 }
 
-static gboolean
-gtk_alt_dialog_button_order (void)
-{
-  gboolean result;
-  g_object_get (gtk_settings_get_default (),
-               "gtk-alternative-button-order", &result, NULL);
-  return result;
-}
-
-/**
- * gtk_alternative_dialog_button_order:
- * @screen: (allow-none): a #GdkScreen, or %NULL to use the default screen
- *
- * Returns %TRUE if dialogs are expected to use an alternative
- * button order on the screen @screen. See
- * gtk_dialog_set_alternative_button_order() for more details
- * about alternative button order.
- *
- * If you need to use this function, you should probably connect
- * to the ::notify:gtk-alternative-button-order signal on the
- * #GtkSettings object associated to @screen, in order to be
- * notified if the button order setting changes.
- *
- * Returns: Whether the alternative button order should be used
- *
- * Since: 2.6
- * Deprecated: 3.10: Deprecated
- */
-gboolean
-gtk_alternative_dialog_button_order (GdkScreen *screen)
-{
-  return gtk_alt_dialog_button_order ();
-}
-
-static void
-gtk_dialog_set_alternative_button_order_valist (GtkDialog *dialog,
-                                                gint       first_response_id,
-                                                va_list    args)
-{
-  GtkDialogPrivate *priv = dialog->priv;
-  GtkWidget *child;
-  gint response_id;
-  gint position;
-
-  response_id = first_response_id;
-  position = 0;
-  while (response_id != -1)
-    {
-      /* reorder child with response_id to position */
-      child = dialog_find_button (dialog, response_id);
-      if (child != NULL)
-        gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
-      else
-        g_warning ("%s : no child button with response id %d.", G_STRFUNC,
-                   response_id);
-
-      response_id = va_arg (args, gint);
-      position++;
-    }
-}
-
-/**
- * gtk_dialog_set_alternative_button_order:
- * @dialog: a #GtkDialog
- * @first_response_id: a response id used by one @dialog’s buttons
- * @...: a list of more response ids of @dialog’s buttons, terminated by -1
- *
- * Sets an alternative button order. If the
- * #GtkSettings:gtk-alternative-button-order setting is set to %TRUE,
- * the dialog buttons are reordered according to the order of the
- * response ids passed to this function.
- *
- * By default, GTK+ dialogs use the button order advocated by the
- * [GNOME Human Interface Guidelines](http://library.gnome.org/devel/hig-book/stable/)
- * with the affirmative button at the far
- * right, and the cancel button left of it. But the builtin GTK+ dialogs
- * and #GtkMessageDialogs do provide an alternative button order,
- * which is more suitable on some platforms, e.g. Windows.
- *
- * Use this function after adding all the buttons to your dialog, as the
- * following example shows:
- *
- * |[<!-- language="C" -->
- * cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- *                                        _("_Cancel"),
- *                                        GTK_RESPONSE_CANCEL);
- *
- * ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- *                                    _("_OK"),
- *                                    GTK_RESPONSE_OK);
- *
- * gtk_widget_grab_default (ok_button);
- *
- * help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- *                                      _("_Help"),
- *                                      GTK_RESPONSE_HELP);
- *
- * gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
- *                                          GTK_RESPONSE_OK,
- *                                          GTK_RESPONSE_CANCEL,
- *                                          GTK_RESPONSE_HELP,
- *                                          -1);
- * ]|
- *
- * Since: 2.6
- * Deprecated: 3.10: Deprecated
- */
-void
-gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
-                                        gint       first_response_id,
-                                        ...)
-{
-  GtkDialogPrivate *priv = dialog->priv;
-  va_list args;
-
-  g_return_if_fail (GTK_IS_DIALOG (dialog));
-
-  if (priv->constructed && priv->use_header_bar)
-    return;
-
-  if (!gtk_alt_dialog_button_order ())
-    return;
-
-  va_start (args, first_response_id);
-
-  gtk_dialog_set_alternative_button_order_valist (dialog,
-                                                 first_response_id,
-                                                 args);
-  va_end (args);
-}
-/**
- * gtk_dialog_set_alternative_button_order_from_array:
- * @dialog: a #GtkDialog
- * @n_params: the number of response ids in @new_order
- * @new_order: (array length=n_params): an array of response ids of
- *     @dialog’s buttons
- *
- * Sets an alternative button order. If the
- * #GtkSettings:gtk-alternative-button-order setting is set to %TRUE,
- * the dialog buttons are reordered according to the order of the
- * response ids in @new_order.
- *
- * See gtk_dialog_set_alternative_button_order() for more information.
- *
- * This function is for use by language bindings.
- *
- * Since: 2.6
- * Deprecated: 3.10: Deprecated
- */
-void
-gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
-                                                    gint       n_params,
-                                                    gint      *new_order)
-{
-  GtkDialogPrivate *priv = dialog->priv;
-  GtkWidget *child;
-  gint position;
-
-  g_return_if_fail (GTK_IS_DIALOG (dialog));
-  g_return_if_fail (new_order != NULL);
-
-  if (dialog->priv->use_header_bar)
-    return;
-
-  if (!gtk_alt_dialog_button_order ())
-    return;
-
-  for (position = 0; position < n_params; position++)
-  {
-      /* reorder child with response_id to position */
-      child = dialog_find_button (dialog, new_order[position]);
-      if (child != NULL)
-        gtk_box_reorder_child (GTK_BOX (priv->action_area), child, position);
-      else
-        g_warning ("%s : no child button with response id %d.", G_STRFUNC,
-                   new_order[position]);
-    }
-}
-
 typedef struct {
   gchar *widget_name;
   gint response_id;
index 17f0503ac452e6d42fbd83e690668b76f716c6c3..1538bef7152d96b2af8a544bdbda5a23d55a9ef2 100644 (file)
@@ -179,17 +179,6 @@ GDK_AVAILABLE_IN_ALL
 gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
                                          GtkWidget *widget);
 
-GDK_DEPRECATED_IN_3_10
-gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
-GDK_DEPRECATED_IN_3_10
-void     gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
-                                                  gint       first_response_id,
-                                                  ...);
-GDK_DEPRECATED_IN_3_10
-void     gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
-                                                             gint       n_params,
-                                                             gint      *new_order);
-
 /* Emit response signal */
 GDK_AVAILABLE_IN_ALL
 void gtk_dialog_response           (GtkDialog *dialog,
index a3e5636d524ed5da4d640df71bf834a4ed597a20..a6a75f8f505c932c9e779c580e217f80be5c7bb6 100644 (file)
@@ -516,13 +516,6 @@ gtk_file_chooser_native_init (GtkFileChooserNative *self)
 
   gtk_dialog_set_default_response (GTK_DIALOG (self->dialog),
                                    GTK_RESPONSE_ACCEPT);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (self->dialog),
-                                           GTK_RESPONSE_ACCEPT,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
   /* We don't want to destroy on delete event, instead we hide in the response cb */
   g_signal_connect (self->dialog,
                     "delete-event",
index 861bcfb640b702e629844d4a727528fa323b11ae..13383aa8d85b675a70df734326a1752c3491ff4e 100644 (file)
@@ -1478,12 +1478,6 @@ confirm_delete (GtkFileChooserWidget *impl,
                                             _("If you delete an item, it will be permanently lost."));
   gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
   gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Delete"), GTK_RESPONSE_ACCEPT);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_ACCEPT,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
 
   if (gtk_window_has_group (toplevel))
@@ -6374,12 +6368,6 @@ confirm_dialog_should_accept_filename (GtkFileChooserWidget *impl,
 
   gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
   add_custom_button_to_dialog (GTK_DIALOG (dialog), _("_Replace"), GTK_RESPONSE_ACCEPT);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_ACCEPT,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
 
   if (gtk_window_has_group (toplevel))
index 1931a866fbe7ca0caa2ddf5e39f3fdd18f4cd0bf..109f84179ca48661227a0901cc88670caf2264e8 100644 (file)
@@ -152,13 +152,6 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
   gtk_widget_init_template (GTK_WIDGET (fontchooserdiag));
   gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (fontchooserdiag));
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontchooserdiag),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
   priv->select_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_OK);
   priv->cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_CANCEL);
 
index 36a9d6fae617e041f4828eac1e2654e636a7b5d7..ed48e85e185743607a0207eea7cb9899009986f7 100644 (file)
@@ -935,7 +935,6 @@ gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
 {
   GtkDialog* dialog = GTK_DIALOG (message_dialog);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   switch (buttons)
     {
     case GTK_BUTTONS_NONE:
@@ -957,26 +956,17 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     case GTK_BUTTONS_YES_NO:
       gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
       gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
-      gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                              GTK_RESPONSE_YES,
-                                              GTK_RESPONSE_NO,
-                                              -1);
       break;
 
     case GTK_BUTTONS_OK_CANCEL:
       gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
       gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
-      gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                              GTK_RESPONSE_OK,
-                                              GTK_RESPONSE_CANCEL,
-                                              -1);
       break;
       
     default:
       g_warning ("Unknown GtkButtonsType");
       break;
     } 
-G_GNUC_END_IGNORE_DEPRECATIONS
 
   g_object_notify (G_OBJECT (message_dialog), "buttons");
 }
index 8c2893f08773924678b38eff2ed2aabc6804e4a2..83408448e86c1c49fe2138e249b219fd1af93db5 100644 (file)
@@ -547,12 +547,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                           NULL);
   gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (dialog,
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
 
   /* Build contents */
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
index 5659e47c407c90376f0b4e6d48d39bc6e00d0a28..368f03a1ea1dfebc0030272c0bd415cb053be137 100644 (file)
@@ -198,13 +198,6 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
                           NULL);
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                           GTK_RESPONSE_OK,
-                                           GTK_RESPONSE_CANCEL,
-                                           -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
-
   /* Do this in code, we want the translatable strings without the markup */
   gtk_list_store_append (priv->printer_list, &iter);
   tmp = g_strdup_printf ("<b>%s</b>\n%s", _("Any Printer"), _("For portable documents"));
index cbb50ec94bebfe964136bf884820c9ccb9e1c5c7..877337bbcb15edf5639961bb8d4159f1ba46faa3 100644 (file)
@@ -675,12 +675,6 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
                       gtk_dialog_add_button (GTK_DIALOG (dialog),
                                              _("_Replace"),
                                              GTK_RESPONSE_ACCEPT);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-                      gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
-                                                               GTK_RESPONSE_ACCEPT,
-                                                               GTK_RESPONSE_CANCEL,
-                                                               -1);
-G_GNUC_END_IGNORE_DEPRECATIONS
                       gtk_dialog_set_default_response (GTK_DIALOG (dialog),
                                                        GTK_RESPONSE_ACCEPT);